#!/bin/bash
#
# $Id$
#

real_host=`hostname`
os_version=`uname -sr`
server_model=`sudo /usr/sbin/dmidecode -s system-product-name`
sn=`sudo /usr/sbin/dmidecode -s system-serial-number | awk '{print $1}'`
ram=`sudo /usr/sbin/dmidecode -t memory | sed -e '/./{H;$!d;}' -e 'x;/Memory Device/!d;' | awk -F: '$1 ~ /Size/ {print $2}' | awk '$2 ~ /MB/ || $2 ~ /GB/ {print "x", $1, $2}' | uniq -c | sed s/\ //g | tr '\n' ';' | sed s/\;$//`
total_swap=`free | grep "^Swap:" | awk '{print $2}'`
cpu=`cat /proc/cpuinfo | grep "^cpu MHz" | awk -F: '{print "x", $2}' | sed s/\\\..*// | uniq -c | awk '{print $1 $2 $3 " MHz"}' | tr '\n' ';' | sed s/\;$//`
#cpu=`cat /proc/cpuinfo | grep "^model name" | awk '{print "x "$NF, $(NF-2)}' | uniq -c | awk '{print $1 $2 $3, $4 }' | tr '\n' ';' | sed s/\;$//`
internal_hdd=`dmesg | grep "SCSI device" | awk -F"]" '{print $2'} | sort | uniq | awk -F"(" '$2 ~ /MB/ || $2 ~ /GB/ {print "x", $2}' | sed s/\)// | uniq -c | sed s/\ //g | tr '\n' ';' | sed s/\;$//`

echo "HOST:$real_host"
echo "OS:$os_version"
echo "SERVER_MODEL:$server_model"
echo "RAM:$ram"
echo "CPU:$cpu"
echo "SN:$sn"
echo "HDD:$internal_hdd"
